<template>
	<div class="page pageFixed">
		<custom-box close title="详情" @close="close">
			<div class="ishopDetail" >
				<div class="scroll">
					<div class="image"><img :src="itemDetails.avatar"></div>
					<h4>{{itemDetails.name}}（最新版）</h4>
					<div class="price flex jlr">
						<span style="color: #F84638;">价格：{{itemDetails.price_score}}积分 (剩余积分800）</span>
						<span>兑换方式：{{ itemDetails.connect_teacher }}</span>
					</div>
					<div class="price_total">
						合计 <span>600</span>积分/套
					</div>
				</div>
				
				<div class="button ishopDetail_submit" @click="submit">确认兑换</div>
				
			</div>
		</custom-box>
	</div>
</template>
<script>
import { addPresentGiftSend } from '../../api/modules/present'
export default {
	props: {
    itemDetails: {
			type: Object, 
      default: {}
		},
  },
	data(){
		return {
			glbId: getApp().globalData.glb_list.glbId, // 获取全局的id
		}
	},
	mounted() {
		console.log('传过来', this.itemDetails)
	},
	methods:{
		close(){
			this.$emit('close')
		},
		submit(){
			let data =  {
				to: this.itemDetails, 
				form: this.glbId
			}
			// 这里暂时调用 礼物的赠送接口 to:学生ID，from：当前登录的校长(老师）ID
			console.log('详情----', data)
			// addPresentGiftSend().then(res => {
			// 	console.log('res', res)
			// })
			// this.$emit('next')
		}
	}
}
</script>
<style scoped>
	.ishopDetail{padding: .2rem .3rem; position: relative; height: 100%;}
	.ishopDetail .image{width: 100%; height: 2.85rem; border-radius: 5px; overflow: hidden;}
	.ishopDetail .image img{width: 100%; height: 100%; object-fit: cover;}
	.ishopDetail h4{font-size: .3rem; color: #353535; padding:.24rem 0;}
	.ishopDetail .price{font-size: .24rem; color: #353535;}
	.ishopDetail .price_total{font-size: .28rem; text-align: center;  color: #353535; padding-top: .24rem;}
	.ishopDetail .price_total span{color: #F84638; font-size: .36rem;}
	.ishopDetail_submit{position: absolute; bottom: -0.6rem; left: 50%; transform: translateX(-50%);}
</style>